﻿FROM node:lts-alpine AS build-stage

WORKDIR /app

#复制依赖描述文件
COPY package.json package-lock.json ./

#安装依赖
RUN npm ci

COPY . .

RUN npm run build

#运行
FROM nginx:alpine AS production-stage

# 复制构建产物到nginx默认目录
COPY --from=build-stage /app/dist  /usr/share/nginx/html

# 复制自定义nginx配置
COPY nginx.conf /etc/nginx/nginx.conf


# 暴露80端口
EXPOSE 80

# 启动nginx
CMD ["nginx", "-g", "daemon off;"]